using System;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Routing;

namespace MvcCms.Service.Helpers
{
    public static class LinkExtensions 
    {
        public static MvcHtmlString AreaActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName)
        {
            return System.Web.Mvc.Html.LinkExtensions.ActionLink(htmlHelper, linkText, actionName, controllerName, new RouteValueDictionary(new { area = "" }), null);
        }
        public static MvcHtmlString AreaActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object routeValues)
        {
            var routeDictionary = new RouteValueDictionary(routeValues);
            var keyExists = routeDictionary.ContainsKey("area");
            if (!keyExists)
            {
                routeDictionary.Add("area", "");
            }
            return System.Web.Mvc.Html.LinkExtensions.ActionLink(htmlHelper, linkText, actionName, controllerName, routeDictionary, null);
        }
    }
}
